import Vue from 'vue'
import VueRouter from 'vue-router'
//导入routes 变量
import { routes } from '@/router/routePath.js'

Vue.use(VueRouter)

// const routes = [{}]

const router = new VueRouter({
  routes
})

/**
 * // 设置路由导航守卫
  router.beforeEach((to, from, next) => {
  // to要去的页面 from从哪里来 next放行
  const token = window.localStorage.getItem('tokenRB')
  if (token != null) {
    api.getUserInfoApi('/userInfo')
    api.getAllArticlesApi()
    next()
  }

  next()
  })

 */

export default router
